#include "BehaviourFactory.h"

BehaviourFactory* BehaviourFactory::instance = NULL;

BehaviourFactory::BehaviourFactory() {

}

BehaviourFactory::~BehaviourFactory() {
    delete instance;
}

BehaviourFactory* BehaviourFactory::getInstance() {
    if(instance == NULL) {
        instance = new BehaviourFactory();
    }

    return instance;
}

Behaviour* BehaviourFactory::parseBehaviour(std::string behaviour) {
    if(behaviour == "playerBehaviour") {
        return createPlayerBehaviour();
    } else if(behaviour == "cameraBehaviour") {
        return createCameraBehaviour();
    }

    return NULL;
}

PlayerBehaviour* BehaviourFactory::createPlayerBehaviour() {
    return new PlayerBehaviour(Global::getPlayer());
}

CameraBehaviour* BehaviourFactory::createCameraBehaviour() {
    return new CameraBehaviour(Global::getCamera(), Global::getPlayer());
}
